{% load form_helpers %}

<div class="panel panel-default">
    <div class="panel-heading">
        <span class="mdi mdi-magnify" aria-hidden="true"></span>
        <strong>Search</strong>
    </div>
    <div class="panel-body">
        <form action="." method="get" class="form">
            {% for field in filter_form.hidden_fields %}
                {{ field }}
            {% endfor %}
            {% for field in filter_form.visible_fields %}
                <div class="form-group">
                    {% if field.name == "q" %}
                        <div class="input-group">
                            <input type="text" name="q" class="form-control" placeholder="Search" {% if request.GET.q %}value="{{ request.GET.q }}" {% endif %}/>
                            <span class="input-group-btn">
                                <button type="submit" class="btn btn-primary">
                                    <span class="mdi mdi-magnify" aria-hidden="true"></span>
                                </button>
                            </span>
                        </div>
                    {% elif field|widget_type == 'checkboxinput' %}
                        <label for="{{ field.id_for_label }}">{{ field }} {{ field.label }}</label>
                    {% else %}
                        {{ field.label_tag }}
                        {{ field }}
                    {% endif %}
                </div>
            {% endfor %}
            <div class="text-right noprint">
                <button type="submit" class="btn btn-primary">
                    <span class="mdi mdi-magnify" aria-hidden="true"></span> Apply
                </button>
                <a href="." class="btn btn-default">
                    <span class="mdi mdi-close-thick" aria-hidden="true"></span> Clear
                </a>
            </div>
        </form>
    </div>
</div>
